package com.zzq.my.jetpacks.jectpackapp

import android.content.Context
import com.aisier.architecture.base.BaseApp
import com.elvishew.xlog.LogLevel
import com.elvishew.xlog.XLog
import com.facebook.drawee.backends.pipeline.Fresco
import com.scwang.smartrefresh.layout.SmartRefreshLayout
import com.scwang.smartrefresh.layout.api.*
import com.scwang.smartrefresh.layout.constant.SpinnerStyle
import com.scwang.smartrefresh.layout.footer.ClassicsFooter
import com.scwang.smartrefresh.layout.header.ClassicsHeader
import com.zzq.my.jetpacks.net.rxhttp.RxHttpManager


/**
 * 描述：class describe
 * 作者：zhuangzeqin
 * 时间: 2021/11/5-16:15
 * 邮箱：zzq@eeepay.cn
 * 备注:
 */
class APP:BaseApp() {
    init {
        initSmartRefreshLayoutBuilder()
    }
    override fun onCreate() {
        super.onCreate()
//        BodyCallback
//        RetrofitClient.getInstance().initConfig(UrlConfig.TEST_BASEURL)
        RxHttpManager().init(this)
        Fresco.initialize(this)
        XLog.init(LogLevel.ALL)
        XLog.d("你好%s，我今年 %d 岁我试着合并远程分支", "Elvis", 20);
    }

    /**
     * 设置全局的Header构建器,全局的Footer构建器
     */
    private fun initSmartRefreshLayoutBuilder() {
        //设置全局的Header构建器
        SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
            ClassicsHeader(context).setSpinnerStyle(
                SpinnerStyle.Translate
            )
        }
        //设置全局的Footer构建器
        SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
            ClassicsFooter(context).setSpinnerStyle(
                SpinnerStyle.Translate
            )
        }

    }
}